<?php include("Fondo.php"); 
	cabecera();
	sesion();
	Izquierda();
?>
<div id="forum">
<?php
include_once("../FachadaI.php");
$fach = FachadaI::getInstance();
if (isset($_SESSION['k_username'])) {

	print "<link rel='stylesheet' href='style.css' type='text/css'>";
	print "<table class='maintables'>";
	print "<div class='midheading'>Crear Nueva Respuesta</div><br><br><br><br>";
	print "<tr class='maintables'><td>";
	if(isset($_POST['submit'])) {
	    $name=$_SESSION['k_username'];
	    $yourpost=$_POST['yourpost'];
	    // $subject=$_POST['subject'];
	    $subject="";
	    $id=$_POST['id'];
	    if(strlen($yourpost)<1) {

		    print "No introdujo un post.";
	    } else {
		    $fach->pre_agregarMensajeReply($name,$yourpost,$subject,$id);

	   }
	} else {

	    $id=$_GET['id'];
	    print "<form action='../Preparacion/reply.php' method='post'>";
	    print "<input type='hidden' name='id' value='$id'>";
		print "<table class='forotable' border=1>";
		print "<tr class='headlinef'><td><center>";
	    print "Tu Mensaje:<br>";
		print "</center></td></tr>";
		print "<tr class='mainrow'><td>";
	    print "<textarea name='yourpost' rows='15' cols='82'></textarea><br>";
		print "</td></tr>";
		print "<tr class='headlinef'><td><center>";
	    print "<input type='submit' name='submit' value='submit'></form>";
		print "</center></td></tr>";
		print "</table>";
	}
	print "</td></tr></table>";
} else {
	echo 'Usted no se encuentra autenticado, por favor ingrese su login y password o registrese.';
}
?>
</div>
<?php pie();?>